home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Classicos / killerpigs.swf / scripts / frame_8 / PlaceObject2_68_259 / CLIPACTIONRECORD onClipEvent(load).as
Encoding:
Text File  |  2007-03-13  |  1.2 KB  |  58 lines

  1. onClipEvent(load){
  2.    function update()
  3.    {
  4.       if(swooping)
  5.       {
  6.          if(count == 0)
  7.          {
  8.             if(50 < random(100))
  9.             {
  10.                direction = -1;
  11.             }
  12.             else
  13.             {
  14.                direction = 1;
  15.             }
  16.             limit = 10 + random(10);
  17.             count = 1;
  18.          }
  19.          else
  20.          {
  21.             count++;
  22.             if(limit < count)
  23.             {
  24.                count = 0;
  25.             }
  26.          }
  27.          this._x += 5 * direction;
  28.          this._y += 5;
  29.          if(350 < this._y)
  30.          {
  31.             this._y = -30;
  32.             swooping = false;
  33.             _root.bonusship = false;
  34.             count = 0;
  35.             trace("bottom !" + _root.bonusship);
  36.          }
  37.       }
  38.       else
  39.       {
  40.          this._x += -4;
  41.          if(this._x < _root.swoop_point)
  42.          {
  43.             trace("swoop!");
  44.             swooping = true;
  45.          }
  46.          if(this._x < 10)
  47.          {
  48.             _root.bonusship = false;
  49.             swooping = false;
  50.             count = 0;
  51.          }
  52.       }
  53.    }
  54.    status = "ok";
  55.    swooping = false;
  56.    count = 0;
  57. }
  58.